home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
n_b_v203.zip
/
USINGMSK.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
3KB
|
56 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME USINGMSK.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC"
COLOR 7,0
CLS
? "┌─────────────────────────────────────────────────────────────
? "│ fUsingMask$ ( Digits%, Decimals% )
? "├────────────────────────────────────────────────────────────────
? "│ This function returns a string that, when used with PRINT USING
? "│ or USING$ will produce a correctly padded numeric string.
? "│ It's use is straight forward; you need only supply the number
? "│ of places before (Digits%) and after (Decimals%) the decimal point.
? "├──────────────────────────────────────────────────────────────────────
? "│ Just a note here for our European friends and those of you wanting to
? "│ do a good job...... Some countries transpose the comma and period when
? "│ printing numbers. ie: 1,234.45 in the USA would be 1.234,45 elsewhere
? "│ and PowerBASIC has provided the wherewithal to do this quickly and
? "│ easily for any program. Have a close look at the internal variable
? "│ pbvUsingChrs. I've used it below in this example.
? "└──────────────────────────────────────────────────────────────────────────
Old$ = pbvUsingChrs ' save this to restore pbvUsingChrs
S! = 12348.234 ' a good number (this week)
M$ = fUsingMask$( 7, 4 ) ' our using mask
PRINT "This is our mask of 7 Digits% and 4 Decimals% ";
PRINT CHR$(34); M$ CHR$(34)
PRINT
PRINT USING M$; S!; : PRINT " U.S.A."
PRINT
PRINT "Now we will print the number in European format by changing pbvUsingChrs."
PRINT
MID$( pbvUsingChrs, 3, 2 ) = ".,"
PRINT USING M$; S!; : PRINT " European"
pbvUsingChrs = Old$ ' leave it like you found it!